// rankingList.js
var app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        top: [{
                Num: '1',
                photo: '../../img/1.png',
                Name: 'suyulie',
                acount: '175'
            },
            {
                Num: '2',
                photo: '../../img/2.png',
                Name: 'duyu',
                acount: '164'
            }, {
                Num: '3',
                photo: '../../img/3.png',
                Name: 'raydu',
                acount: '131'
            }
        ],
        paihangs: [{
            Num: '4',
            photo: '../../img/me02.png',
            Name: 'xiuyuan',
            acount: '129'
        }, {
            Num: '5',
            photo: '../../img/me02.png',
            Name: 'jiayoumi',
            acount: '127'
        }, {
            Num: '6',
            photo: '../../img/me02.png',
            Name: 'jiayoumi',
            acount: '127'
        }, {
            Num: '7',
            photo: '../../img/me02.png',
            Name: 'jiayoumi',
            acount: '127'
        }, {
            Num: '8',
            photo: '../../img/me02.png',
            Name: 'jiayoumi',
            acount: '127'
        }]
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        var that = this;
        var session_key = wx.getStorageSync('session_key')
        wx.request({
            url: app.data.baseUrl + '/api/Discover/mindCount',
            method: 'POST',
            header: {
                'content-type': 'application/x-www-form-urlencoded'
            },
            data: {
                session_key: session_key,
                gengduo: 'more'
            },
            success: function(res) {
                console.log(res)
                var cate = res.data.data;
                var top = [];
                var cates = [];

                for (var i = 0; i < 3; i++) {
                    top[i] = cate[i]
                }

                for (let j = 2; j < cate.length; j++) {
                    cates[j - 2] = cate[j]
                        // console.log(cates[j - 2])
                        // console.log(cate[j])
                }

                that.setData({
                    cates: cates,
                    top: top
                })
            }
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    }
})